package com.tiancheng.trade.authserver.enums;

/**
 * @Author: likailun
 * @Description: token类型
 * @Date: create in 2024/10/21 15:58
 */
public enum TokenTypeEnum {
    application,
    web_phone,
    web_email,
    qq_web_oauth2,
    oauth2_password,
    oauth2_code,
    app_phone,
    app_qq_oauth2,
    app_weChat_oauth2,
    weChat_miniApp,
    weChat_official_account,
    work_weChat,
    aliPayWeb,
    weChat_web,
    ysf_miniApp;

    public String getTypeName() {
        if (this == application) {
            return "应用程序登陆";
        } else if (this == web_phone) {
            return "web电话登陆";
        } else if (this == web_email) {
            return "web邮箱登陆";
        } else if (this == qq_web_oauth2) {
            return "qq web登陆";
        } else if (this == oauth2_password) {
            return "oauth2密码登陆";
        } else if (this == oauth2_code) {
            return "oauth2验证码登陆";
        } else if (this == app_phone) {
            return "app电话登陆";
        } else if (this == app_qq_oauth2) {
            return "app qq登陆";
        } else if (this == app_weChat_oauth2) {
            return "app微信登陆";
        } else if (this == weChat_miniApp) {
            return "微信小程序登陆";
        } else if (this == weChat_official_account) {
            return "微信公众号登陆";
        } else if (this == work_weChat) {
            return "企业微信登陆";
        } else if (this == aliPayWeb) {
            return "支付宝网页登陆";
        } else if (this == weChat_web) {
            return "微信网页登陆";
        } else if (this == ysf_miniApp) {
            return "云闪付小程序登陆";
        } else {
            return "未知";
        }
    }

    public String getTypeCode() {
        return this.name();
    }

    /**
     * 获取app token类型编码
     */
    public String getAppTypeCode() {
        if (this == app_phone) {
            return "phone";
        } else if (this == app_qq_oauth2) {
            return "qq";
        } else if (this == app_weChat_oauth2) {
            return "wx";
        } else if (this == weChat_miniApp) {
            return "wx_app";
        } else {
            return "unknown";
        }
    }

}
